package com.guigu.www.tangyingmeng.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.guigu.www.mapper.QuotaMapper;
import com.guigu.www.pojo.BespeakPoject;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.Quota;
import com.guigu.www.tangyingmeng.service.TymQuotaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class TymQuotaServiceImpl implements TymQuotaService {

    @Autowired
    private QuotaMapper quotaMapper;

    @Override
    public PageVo<Quota> selquotaall(Map<String, String> map) {
        QueryWrapper<Quota> wrapper = new QueryWrapper<>();
        wrapper.like("quota_id",map.get("findid")).like("quota_name", map.get("findname"));
        IPage<Quota> page = new Page<>(Integer.valueOf(map.get("index")), Integer.valueOf(map.get("pageSize")));
        page = quotaMapper.selectPage(page, wrapper);
        PageVo<Quota> pageVo = new PageVo<>();
        pageVo.setTotal(page.getTotal());
        pageVo.setRows(page.getRecords());
        return pageVo;
    }
}
